﻿using System;
using System.Windows.Forms;

namespace CAN_Controller
{
    public partial class Login : Form
    {
        public Login()
        {
            InitializeComponent();
        }

        private void button_Click(object sender, EventArgs e)
        {
            switch (((Button)sender).Tag.ToString())
            {
                case "ok":
                    {
                        if (user_TxtBox.Text.Equals("admin") && pwd_TxtBox.Text.Equals("123456"))
                        {
                            DialogResult = DialogResult.OK;
                        }
                        else
                        {
                            MessageBox.Show("用户名或密码错误！", "警告",MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        }
                    }
                    break;
                case "cancel":
                    {
                        Close();
                    }
                    break;
                default: break;
            }
        }
    }
}
